package sj.sj.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import sj.sj.dao.supplier.SupplierMapper;
import sj.sj.pojo.Supplier;
import sj.sj.service.SupplierService;

import java.util.List;

@Transactional
@Service("supplierService")
public class SupplierServiceImpl implements SupplierService {

    @Autowired
    private SupplierMapper supplierMapper;

    @Override
    public List<Supplier> getList(Supplier supplier) {
        return supplierMapper.selectSupplierList(supplier);
    }

    @Override
    public boolean addSupplier(Supplier supplier) {
        if(supplierMapper.addSupplier(supplier)==1){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean delSupplier(Integer id) {
        if(supplierMapper.delSupplier(id)==1){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean updateSupplier(Supplier supplier) {
        if(supplierMapper.updateSupplier(supplier)==1){
            return true;
        }else {
            return false;
        }
    }

}
